package generic.gui.util;
import java.awt.Font;
import java.awt.event.KeyListener;

@SuppressWarnings("serial")
public class JTextLabelLateralForm extends JPanelForm {
	
	private JTextFieldForm text;
	private JLabelForm label;
	
	public JTextLabelLateralForm(String label) {
		setLayout(null);
		getLabel().setText(" " +label);
		add(getText());
		add(getLabel());
	}

	public JTextFieldForm getText() {
		if (text == null) {
			text = new JTextFieldForm();
			text.setFont(new Font("Calibri", Font.PLAIN, 14));
		}
		return text;
	}

	public void setText(JTextFieldForm text) {
		this.text = text;
	}

	public JLabelForm getLabel() {
		if (label == null) {
			label = new JLabelForm();
			label.setFont(new Font("Calibri", Font.PLAIN, 14));
		}
		return label;
	}

	public void setLabel(JLabelForm label) {
		this.label = label;
	}
	public void setBounds(int x,int y,int width,int height) {
		super.setBounds(x, y, width, height);
		getText().setBounds(x, 0, 90, height);
		getLabel().setBounds(x + 90 + 5, 0, width - (x + 90) , height);
	}
	public void setColumns(int arg0) {
		getText().setColumns(arg0);
	}
	
	public void addKeyListener(KeyListener l) {
		getText().addKeyListener(l);
	}
	
	@Override
	public void grabFocus() {
		getText().grabFocus();
	}
}
